Xceed .NET Libraries Documentation
Xceed.Zip Assembly / Xceed.Zip Namespace / QuickZip Class / Zip Method / Zip(String,String[]) Method
The fully-qualified path and name of the zip file.
The files to add to zipFileName. Can contain filemasks and folder names (ending with a backslash). All subfolders will also be scanned for the specified file(s) even if wildcards are not used. For example, if "C:\test.txt" is specified, all "test.txt" files found on the "C:\" drive will be added to the zip file. Folders specified with the backslash after them will include their entire contents. Cannot be NULL.
Example


In This Topic
    Zip(String,String[]) Method
    In This Topic
    Adds files recursively to a zip file overwriting existing files and preserving the directory structure.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub Zip( _
       ByVal zipFileName As String, _
       ByVal ParamArray filesToZip() As String _
    ) 
    'Usage
     
    
    Dim zipFileName As String
    Dim filesToZip() As String
     
    QuickZip.Zip(zipFileName, filesToZip)
    public static void Zip( 
       string zipFileName,
       params string[] filesToZip
    )

    Parameters

    zipFileName
    The fully-qualified path and name of the zip file.
    filesToZip
    The files to add to zipFileName. Can contain filemasks and folder names (ending with a backslash). All subfolders will also be scanned for the specified file(s) even if wildcards are not used. For example, if "C:\test.txt" is specified, all "test.txt" files found on the "C:\" drive will be added to the zip file. Folders specified with the backslash after them will include their entire contents. Cannot be NULL.
    Remarks

    If zipFileName does not exist, it will be created and then the files will be added.

    Note that existing files will be overwritten, the directory structure will be preserved within the zip file and files contained within sub-folders will also be added to the zip file.

    By default, Unicode and FileTimes extra headers are stored in the zip file when new items are added to the zip file. The extra headers of items that already exist in the zip file will not be modified.

    All zip files will automatically be created in the Zip64 zip file format if the limitations of the regular Zip format are reached.

    Example
    NULL
    Example
    NULL
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Standard: netstandard2.0, netstandard2.1

    .NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also